package com.hyts.schedule.executor.Job;

import com.alibaba.fastjson.JSONObject;
import com.hyts.aop.annotation.Aspect;
import com.hyts.guava.object.Objects;
import com.hyts.jlogger.manager.LoggerManager;
import com.hyts.schedule.executor.handler.Task;
import com.hyts.schedule.executor.model.JobBean;

import java.util.UUID;
import java.util.logging.Logger;

/**
 * project-name:coffice-toolbox
 * package-name:com.hyts.schedule.quartz.Job
 * author:Libo/Alex
 * create-date:2019-05-08 23:17
 * copyright:libo-hyts-github
 * email:libo2dev@aliyun.com
 * description:此类主要用于: 用于操作适配工作能力-具有相关hook功能和监控功能
 */
@Aspect
public class TaskAdapter extends Task {


    Logger log = LoggerManager.getLogger(TaskAdapter.class);


    @Override
    public final JobBean run(JobBean jobBean) {
        log.info("执行操作"+ Objects.toString(jobBean));
        log.info("输入参数:"+jobBean.getParamJson());
        JSONObject result = jobBean.getParamJson();
        result.put("uuid", UUID.randomUUID().toString());
        jobBean.setResultJson(execute(result));
        log.info("输出参数:"+jobBean.getResultJson());
        return jobBean;
    }

    //@Ignore
    public JSONObject execute(JSONObject param){
        log.info("等待子类完成execute()方法");
        return null;
    }

}
